<?php
class Application_Model_DbTable_Smtp extends Zend_Db_Table_Abstract
{
	protected $_name = 'Smtp';

	public function getSmtp($id)
	{
		$id = (int)($id);
		$row = $this->fetchRow('id = ' . $id);
		if (!$row)
		{
			throw new Exception("could not found row");
		}
		return $row->toArray();
	}
	
	public function addSmtp($server, $port, $username, $password, $tls)
	{
		$data = array('server' => server,
				'port' => $port,
				'username' => $username,
				'password' => $password,
				'tls' => $tls);
		$this->insert($data);
	}
	
	public function updateSmtp($id,$server, $port, $username, $password, $tls)
	{
		$data = array('server' => server,
				'port' => $port,
				'username' => $username,
				'password' => $password,
				'tls' => $tls);
		$this->update($data, 'id = ' . (int)$id);
	}
	
	public function deleteSmtp($id)
	{
		$this->delete('id =' . (int)$id);
	}
}